package short_semester.questionnaire_planet.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import short_semester.questionnaire_planet.pojo.QuestionnaireRecord;
import short_semester.questionnaire_planet.pojo.ScoreQuestion;
import short_semester.questionnaire_planet.pojo.ScoreQuestionRecord;

import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;

public interface ScoreQuestionRecordDao extends JpaRepository<ScoreQuestionRecord,Integer> {
    List<ScoreQuestionRecord> findAllByQuestionnaireRecord(QuestionnaireRecord questionnaireRecord);

    Optional<ScoreQuestionRecord> findByQuestionnaireRecordAndScoreQuestion(
            QuestionnaireRecord questionnaireRecord,
            ScoreQuestion scoreQuestion);


    @Transactional
    @Modifying
    void deleteByScoreQuestion(ScoreQuestion scoreQuestion);
    
}
